<html>
<head><meta charset="utf-8"><title>Challenges for move/init, liveness, and `Location::All` · t-compiler/wg-polonius · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/index.html">t-compiler/wg-polonius</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html">Challenges for move/init, liveness, and `Location::All`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247852147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247852147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247852147">(Aug 01 2021 at 10:25)</a>:</h4>
<p>In order to release a new version and update rustc, I was doing the periodical round of rustc UI tests. There were a few more tests that trigger the "has been running for over 60 seconds" warning.</p>
<p>To try to locate the source of those a bit more, I tried what we mentioned last time: temporarily disabling the computation of move errors in polonius: the <code>move_error</code> relation, not disabling move/init analysis since the other relation it computes, <code>var_maybe_partly_initialized_on_exit</code> is needed in liveness.</p>
<p>We mentioned this work-around last time because: for the in-tree <code>clap</code> benchmark, <code>var_maybe_partly_initialized_on_exit</code> was quick to compute, and it was only <code>move_error</code> which was slow and rustc doesn't emit these move error tuples anyway.</p>



<a name="247852154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247852154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247852154">(Aug 01 2021 at 10:25)</a>:</h4>
<p>That reduces the number of slow from around 9/10 to 4. However, the few that remain were interesting so here goes.</p>



<a name="247852296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247852296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247852296">(Aug 01 2021 at 10:28)</a>:</h4>
<p>Computing <code>var_maybe_partly_initialized_on_exit</code> is still challenging for <br>
1) <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-29466.rs">issue-29466.rs</a></p>
<div class="codehilite"><pre><span></span><code>initialization - initialization phase 1 completed: 456.1µs
initialization - initialization phase 2: 0 move errors in 55.9308185s
liveness - compute_live_origins() completed: 184 tuples, 3.2969735s
location_insensitive - analysis done: 0 `potential_errors` tuples, 0 `potential_subset_errors` tuples, 1.5408ms
</code></pre></div>



<a name="247852528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247852528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247852528">(Aug 01 2021 at 10:34)</a>:</h4>
<p>2) somewhat less for <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-29540.rs">issue-29540.rs</a>. This is a big struct with a derived Debug impl, and therefore a big <code>fmt</code> method</p>
<div class="codehilite"><pre><span></span><code>initialization - initialization phase 1 completed: 314.8µs
initialization - initialization phase 2: 0 move errors in 12.5954316s
liveness - compute_live_origins() completed: 6289900 tuples, 5.1522267s
location_insensitive - analysis done: 0 `potential_errors` tuples, 0 `potential_subset_errors` tuples, 3.5877139s
</code></pre></div>
<p>note: it does not trigger the 60s warning out of itself (but because of fact generation, so we'll see this test again a bit later) but I mention it because of the init phase 2 numbers</p>



<a name="247852566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247852566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247852566">(Aug 01 2021 at 10:35)</a>:</h4>
<p>3) another huge expression in <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs">issue-74564-if-expr-stack-overflow.rs</a></p>
<div class="codehilite"><pre><span></span><code>initialization - initialization phase 1 completed: 2.1267ms
initialization - initialization phase 2: 0 move errors in 763.1589101s
liveness - compute_live_origins() completed: 229006 tuples, 44.9736213s
location_insensitive - analysis done: 0 `potential_errors` tuples, 0 `potential_subset_errors` tuples, 10.2061ms
</code></pre></div>



<a name="247852777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247852777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247852777">(Aug 01 2021 at 10:40)</a>:</h4>
<p>Now for the issues caused by<code>Location::All</code>: these will be the time/size of the generated facts dumped on disk (so it will be bigger and slower than using the in-memory facts, but that data is easier to obtain) with some info about one of our potential fixes: having a dedicated <code>subset_everywhere</code> relation (which we know we don't want to do, it's just for illustration purposes)</p>



<a name="247853079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247853079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247853079">(Aug 01 2021 at 10:48)</a>:</h4>
<p>1) <a href="http://issue-29466.rs">issue-29466.rs</a> from above: <code>-Znll-facts</code>: 11s / <code>-Znll-facts</code> with <code>Locations::All</code> fixed: 0.7s<br>
2) <a href="http://issue-29540.rs">issue-29540.rs</a> from above: <code>-Znll-facts</code>: 4.5G, all of it in <code>subset_base</code>. 2m51.824s / <code>-Znll-facts</code> with <code>Locations::All</code> fixed: 1.2s<br>
3) <a href="http://issue-74564-if-expr-stack-overflow.rs">issue-74564-if-expr-stack-overflow.rs</a> from above, but subsets aren't the main source of facts here: <code>-Znll-facts</code>: 24.4s / <code>-Znll-facts</code> with <code>Locations::All</code> fixed: 19s</p>



<a name="247853100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247853100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247853100">(Aug 01 2021 at 10:49)</a>:</h4>
<p>and my personal favorite: 4) <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/repr/repr-no-niche.rs">repr-no-niche.rs</a>: <code>-Znll-facts</code>: 41GB, 41mins / <code>-Znll-facts</code> with <code>Locations::All</code> fixed: 4.7s</p>
<p>Note: this one has mutiple functions (10-15) compared to the other tests above. So there are a few functions with 11GB facts, not a single 41GB one.</p>



<a name="247853243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247853243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247853243">(Aug 01 2021 at 10:53)</a>:</h4>
<p>(This is not an exhaustive list: overall around 20 tests or so fail for different reasons, most because of updated diagnostics that need to be blessed. But some that ultimately OOM are also in the list above. And there were a couple known fact generation OOMs in the intrinsics tests, which were the reason we initially discussed this issue)</p>



<a name="247854208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Challenges%20for%20move/init%2C%20liveness%2C%20and%20%60Location%3A%3AAll%60/near/247854208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60.html#247854208">(Aug 01 2021 at 11:16)</a>:</h4>
<p>so to summarize, in this little graph of the pipeline:</p>
<div class="codehilite"><pre><span></span><code>                                    Move/init analysis                              Liveness             Loan/subset analysis
                                    ──────────────────                              ────────             ────────────────────

┌─────────────────────────┐      ┌────────────────────────────────────────┐      ┌────────────┐       ┌────────────────────────┐
│  rustc fact generation  ├─────►│  var_maybe_partly_initialized_on_exit  ├─────►│  liveness  ├──────►│  Location insensitive  │
└─────────────────────────┤      └────────────────────────────────────────┘      └────────────┘       └──────────┬─────────────┘
                          │                                                                                      │
                          │                                                                                      ▼
                          │      ┌──────────────┐                                                      ┌─────────────────────┐
                          └─────►│  move_error  │                                                      │  Naive/DatafrogOpt  │
                                 └──────────────┘                                                      └─────────────────────┘
</code></pre></div>
<p>we have known issues in every single node, but: some have fixes in progress, some can be bypassed, some have mitigations in progress, and some only have proposed solutions that need to be implemented and tested. (And since some of these problems currently compound, fixing them will also improve things later in the pipeline)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>